package com.me.mygdxgame;

import android.content.Context;
import android.os.Bundle;
import android.os.PowerManager;
import android.view.WindowManager;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;

public class MainActivity extends AndroidApplication
{
	private PowerManager.WakeLock wl;
	
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);

		getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

		AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
		cfg.useGL20 = true;

		initialize(new RacingGame(), cfg);
		
		PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
		
		wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
		
	}
	
	@Override
	public void onPause()
	{
		super.onPause();
		wl.release();
	}
	
	@Override
	public void onResume()
	{
		super.onResume();
		wl.acquire();
	}
}
